//---------------------------------------------------------------------------

#ifndef uSWebHelpH
#define uSWebHelpH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ExtCtrls.hpp>
#include <DBCtrls.hpp>
#include <Graphics.hpp>
#include "CStrGrid.h"
#include <Grids.hpp>
#include <ComCtrls.hpp>
#include <ImgList.hpp>
#include <Menus.hpp>
//---------------------------------------------------------------------------
#include "CLogiciel.h"
#include "CVersion.h"
#include "CReference.h"
#include "WebHelp.h"
#include <Menus.hpp>
#include <ImgList.hpp>
#include "CComboBx.h"
//---------------------------------------------------------------------------
#include "vSAjoutLogiciel.h"
#include "vSCopyLogiciel.h"
#include "vCSupprLogMenu.h"
#include "CKeyWebHelp.h"
//---------------------------------------------------------------------------
#include "vSAjoutVersion.h"
#include "vSCopyVersion.h"
#include "vSSupprVerMenu.h"
#include "vLHistorique.h"
#include "CEdit.h"
#include "CCheckB.h"
#include "CComboBx.h"
//---------------------------------------------------------------------------
//Définitions des requetes d'affichage
//------------------------------------
#define AFFICHAGE_LOG_VER  "select  ref_nom,\
                                    ref_code,\
                                    ref_sous_nom,\
                                    ref_adresse,\
                                    ref_attente,\
                                    ref_etat \
                            from refer where (log_code = %d \
                            and ver_code = %d) %s order by ref_nom"

#define AFFICHAGE_CONDITION "select  ref_nom,\
                                     ref_code,\
                                     ref_sous_nom,\
                                     ref_adresse,\
                                     ref_attente,\
                                     ref_etat \
                             from refer where ref_nom in (%s) \
                              and (log_code = %d \
                              and ver_code = %d) %s order by ref_nom"

#define AFFICHAGE_LOG   "select log_nom,\
                               ref_code,\
                               ver_nom,\
                               ref_nom,\
                               ref_sous_nom,\
                               ref_adresse,\
                               ref_attente,\
                               ref_etat \
                        from refer \
                           left outer join logiciels on \
                               (refer.log_code = logiciels.log_code) \
                           inner join versions on \
                               (refer.ver_code = versions.ver_code) \
                           where refer.log_code = %d %s order by ref_nom"

#define AFFICHAGE_ALL   "select log_nom,\
                               ref_code,\
                               ver_nom,\
                               ref_nom,\
                               ref_sous_nom,\
                               ref_adresse,\
                               ref_attente,\
                               ref_etat \
                        from refer \
                           left outer join logiciels on \
                               (refer.log_code = logiciels.log_code) \
                           inner join versions on \
                               (refer.ver_code = versions.ver_code) %s order by ref_nom"
//---------------------------------------------------------------------------
extern bool bAfficheBoutonsDuBas;
//---------------------------------------------------------------------------
class TuGestionAdresse : public TForm
{
    __published:	// Composants gérés par l'EDI
        TPanel *Panel3;
        TPanel *Panel4;
        TListView *lvReference;
        TPanel *pFiltre;
        TMainMenu *mmWebHelp;
        TMenuItem *Fichier1;
        TMenuItem *Quitter;
        TMenuItem *Logiciels1;
        TMenuItem *Versions1;
        TMenuItem *Outils1;
        TMenuItem *OrganiserLog;
        TMenuItem *OrganiserVer;
        TMenuItem *Historique1;
        TSpeedButton *bbAjouter;
        TSpeedButton *bbModifier;
        TSpeedButton *bbConsulter;
        TSpeedButton *bbSupprimer;
        TSpeedButton *bbCopier;
        TSpeedButton *bbDeSelect;
        TSpeedButton *bbSelectAll;
        TSpeedButton *bImporter;
        TLabel *Label1;
        TLabel *Label2;
        TLabel *Label3;
        TImageList *ImgListRef;
        TLabel *Label4;
        CComboBox *cbLogiciel;
        TMenuItem *N2;
        TMenuItem *AjouterLog;
        TMenuItem *N3;
        TMenuItem *AjouterVer;
        CComboBox *cbReference;
        CComboBox *cbDesignation;
        CComboBox *cbPageWeb;
        CComboBox *cbPage;
        TMenuItem *DupliquerLog;
        TMenuItem *SupprimerLog;
        TMenuItem *DupliquerVer;
        TMenuItem *SupprimerVer;
        TPanel *pBoutonRazFiltre;
        TSpeedButton *bRaz;
        TPanel *pComboVer;
        CComboBox *cbVersion;
        TLabel *Label5;
        TPanel *pVerifier;
        TSpeedButton *sbVerifier;
        TPanel *pFiltreEtat;
        TLabel *Label6;
        CEdit *eReference;
        CEdit *eDesignation;
        TLabel *lRefWebHelp;
    TMenuItem *N1;
    TMenuItem *AideWebHelp1;
    TPanel *Panel1;
    TLabel *lOk;
    TLabel *Label7;
    TImage *Image1;
    TImage *Image2;
    TImage *Image3;
    TLabel *Label8;
    CCheckBox *cbOK;
    CCheckBox *cbNok;
    CCheckBox *cbAnomalie;
    TLabel *Label9;

        void __fastcall cbLogicielChange(TObject *Sender);
        void __fastcall bRazClick(TObject *Sender);
        void __fastcall bbAjouterClick(TObject *Sender);
        void __fastcall cbVersionChange(TObject *Sender);
        void __fastcall bbModifierClick(TObject *Sender);
        void __fastcall bbSupprimerClick(TObject *Sender);
        void __fastcall bbConsulterClick(TObject *Sender);
        void __fastcall bbCopierClick(TObject *Sender);
        void __fastcall bbSelectAllClick(TObject *Sender);
        void __fastcall bbDeSelectClick(TObject *Sender);
        void __fastcall cbReferenceChange(TObject *Sender);
        void __fastcall cbDesignationChange(TObject *Sender);
        void __fastcall cbPageWebChange(TObject *Sender);
        void __fastcall eReferenceChange(TObject *Sender);
        void __fastcall eDesignationChange(TObject *Sender);
        void __fastcall bImporterClick(TObject *Sender);
        void __fastcall lvReferenceCustomDrawSubItem(TCustomListView *Sender,
        TListItem *Item, int SubItem, TCustomDrawState State,
        bool &DefaultDraw);
        void __fastcall QuitterClick(TObject *Sender);
        void __fastcall OrganiserLogClick(TObject *Sender);
        void __fastcall OrganiserVerClick(TObject *Sender);
        void __fastcall lvReferenceColumnClick(TObject *Sender,
          TListColumn *Column);
        void __fastcall lvReferenceCompare(TObject *Sender, TListItem *Item1,
              TListItem *Item2, int Data, int &Compare);
        void __fastcall AjouterVerClick(TObject *Sender);
        void __fastcall AjouterLogClick(TObject *Sender);
        void __fastcall lvReferenceDblClick(TObject *Sender);
        void __fastcall DupliquerVerClick(TObject *Sender);
        void __fastcall DupliquerLogClick(TObject *Sender);
        void __fastcall SupprimerLogClick(TObject *Sender);
        void __fastcall SupprimerVerClick(TObject *Sender);
        void __fastcall sbVerifierClick(TObject *Sender);
        void __fastcall lvReferenceGetSubItemImage(TObject *Sender,
          TListItem *Item, int SubItem, int &ImageIndex);
        void __fastcall FormResize(TObject *Sender);
        void __fastcall cbOKClick(TObject *Sender);
        void __fastcall cbNokClick(TObject *Sender);
        void __fastcall cbAnomalieClick(TObject *Sender);
    void __fastcall AideWebHelp1Click(TObject *Sender);
    void __fastcall Historique1Click(TObject *Sender);
    void __fastcall cbPageExit(TObject *Sender);
    void __fastcall cbPageChange(TObject *Sender);

    private:	// Déclarations utilisateur
        int  m_nColumnToSort;
        int  m_nLastColumn;
        bool m_bAscToDesc;
        bool m_bEtat;
        bool m_bEtatRienAAfficher;
        int  m_nColonneEtat;
        AnsiString m_asConditionIn;
        
    private:
        void __fastcall AccederParamCtrlF3( void );
        void __fastcall AjouterListeLogiciel( void );
        void __fastcall AjouterListeVersion( void );
        AnsiString __fastcall GererFiltrage( void );
        void __fastcall Afficher( const AnsiString &asFilter = EmptyStr );
        void __fastcall ConstruireListView( void );
        void __fastcall Modifier( void );
        AnsiString __fastcall FiltrerEtat( void );
        AnsiString __fastcall DeterminerRequete(    const int &nLogiciel,
                                                    const int &nVersion,
                                                    const AnsiString &asFilter );
        bool __fastcall DeterminerNbrColonne(   const int &nLogiciel,
                                                const int &nVersion );

    public:		// Déclarations utilisateur
        __fastcall TuGestionAdresse(TComponent* Owner);
        void __fastcall SetConditionIn( const AnsiString &asValue ) {m_asConditionIn = asValue;};

    public:
        __property AnsiString ConditionIn = {read=m_asConditionIn , write=SetConditionIn};
};
//---------------------------------------------------------------------------
extern PACKAGE TuGestionAdresse *uGestionAdresse;
//--------------------------------------------------------------------------
#endif
